A Formal Semantics of Flexible and Safe Pointcut/Advice Bindings
نویسندگان
چکیده
AspectJ was designed as a seamless aspect-oriented extension of the Java programming language. However, unlike Java, AspectJ does not have a safe type system: an accepted binding between a pointcut and an advice can give rise to type errors at runtime. In addition, AspectJ’s typing rules are severely restricting the definition of certain generic advice behavior. In this technical report, we present a formal semantics and a type system for an extension of AspectJ that addresses these issues. The type system, in particular, ensures safety for both generic and non-generic pointcut/advice declarations. Pointcuts quantify over heterogeneous sets of join points and are hence typed using type ranges in our approach, while type variables and a separate signature for proceed declarations allow to express the generic and invasive nature of advices. Using these mechanisms, we can express advice that augments, narrows or replaces base functionality in possibly generic contexts. Concretely, this report briefly reviews the type safety problems of pointcut/advice bindings in AspectJ-like languages and previous (partial) solutions to these problems that have been proposed in the literature. We then give a brief overview of our approach. Finally, we give a complete formal account of our approach by presenting evaluation rules, typing rules, type preservation and progress theorems as well as corresponding proofs.
منابع مشابه
Towards Efficient Virtual Machine Support for Flexible, Dynamic Deployment of Inter-type Declarations
Dynamic deployment is an important feature of an aspect-oriented language design that has many software engineering benefits, e.g. in runtime monitoring, runtime adaptation to fix bugs or add features to long running applications, runtime update of dynamic policy changes, etc. Many recently proposed language designs support these use cases. In previous work, researchers have demonstrated that t...
متن کاملFoundations of Aspect - Oriented Languages Workshop at AOSD 2002
A characteristic of aspect-oriented programming, as embodied in AspectJ, is the use of advice to incrementally modify the behavior of a program. An advice declaration specifies an action to be taken whenever some condition arises during the execution of the program. The condition is specified by a formula called a pointcut designator or pcd. The events during execution at which advice may be tr...
متن کاملFOAL 2002 Proceedings: Foundations of Aspect-Oriented Langauges Workshop at AOSD 2002
A characteristic of aspect-oriented programming, as embodied in AspectJ, is the use of advice to incrementally modify the behavior of a program. An advice declaration specifies an action to be taken whenever some condition arises during the execution of the program. The condition is specified by a formula called a pointcut designator or pcd. The events during execution at which advice may be tr...
متن کاملTowards Efficient Java Virtual Machine Support for Dynamic Deployment of Inter-type Declarations
Dynamic deployment is an important feature of an aspectoriented language design that has many applications, e.g. in runtime monitoring, runtime adaptation to fix bugs or add features to long running applications, runtime update of dynamic policy changes, etc. Many recently proposed language designs support these use cases. In previous work, researchers have demonstrated that the ability to supp...
متن کاملAnalyzing polymorphic advice
We take one of the first steps towards developing a practical, statically-typed, functional, aspect-oriented programming language by showing how to integrate polymorphism and type analysis with aspect-oriented programming features. In particular, we demonstrate how to define type-safe polymorphic adviceusing pointcuts that unify a collection of polymorphic join points. We also i...
متن کامل